# New ASM File
teamselect:
.asciiz "\nPick a team for your semester project."

teamlist:
.asciiz "\n1. Meta team: You will take all of the credit and do none of the work.\n2. Front end: Go fetch!	\n3. Hazards: You will toil to no avail as your code is eventually replaced.\n4. Execution: Um... you develop an ALU and falsely proclaim its perfection.\n5. Tests: You won't really do anything."

select_meta:
.asciiz "\nWhat were you thinking? Oh well... your abilities are:\nKittystorm\nPuppystorm\nBunnystorm\nSummon the Cassi"

select_front:
.asciiz "\n*throws stick off into distance* Once you return this stick to me, you will be able to: \nFetch\nDecode\nPC++++++++\nSign extendz"

select_haz:
.asciiz "\nI'm sorry. As a consolation prize, you gain the ability to: \nStall\nBubble\nForward\nnop"

select_ex:
.asciiz "\nI choose you, exeggutor! Exeggutor wants to learn:\num\numm\nummm\nummmm"

select_test:
.asciiz "\nAre you sure you chose correctly? You should put that into a testbench... Your outputs should be: \nDelay\nDeflect Criticism\nConfusion\nInvalidate"

team_build:
.asciiz "\nWelcome to the machine. What would you like to do to build up your team?\n1. Never show up, never contibute.\n2. Screw team, do all work.\n3. Show up to meetings, but contrbiute nothing but noise.\n4. Contribute equal part of work load."

research_intro:
.asciiz "\nUse the powers of your keyboard to research the class project."

key_x:
.asciiz "\nCongratulations, you found an Xbox. Unfortunately your time is now consumed playing Call of Duty: Black Ops and you are unable to complete research. End of line."

key_m:
.asciiz "\nYou decide to take a break and play some Magicka. Wira teamkills you with a thunderbolt. You have wasted an afternoon."

key_p:
.asciiz "\nIn an effort to discover more research materials, you head down to the basement and discover Dr. Sohoni playing ping-pong. You are frightened by his raw skill. You flee."

key_i:
.asciiz "\nYou attempt to search the internet for information relating to the project. Unfortunately, all you can find are hilarious cat videos. That's not how you walk on a treadmill, kitty!"

key_ampersand:
.asciiz "\nRobert, Chris and Will are super cool guys. The more you know..."

key_l:
.asciiz "\nYou head to the library and actually read your comp arch book. Congratulations... knowledge++;"

key_c:
.asciiz "\nYou attend class and Fritz melts your face off with a deadly blast of knowledge. Knowledge++"

key_f:
.asciiz "\nYou mistakenly wander into ES101F during lab hours. You watch Fritz and Wira do something neat. Knowledge++"

knowledge:
.word 0x00000000

doc_intro: 
.asciiz "\nCongratulations, it is now time for your documentation. What will you do?\n1. Document material as researched.\n2. nop\n3. Help I'm trapped in the Comp Arc lab"

phase_one_begin:
	li $a0, teamselect
	jal libplp_uart_write_string
	nop
	li $a0, teamlist
	jal libplp_uart_write_string
	nop
	jal libplp_uart_read
	nop
	# did you pick metateam?
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, meta_dude
	nop
	# did you pick frontend?
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, front_dude
	nop
	# did you pick hazards?
	move $t0, $v0
	li $t1, 0x00000033
	beq $t0, $t1, haz_dude
	nop
	# did you pick ex?
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, ex_dude
	nop
	# did you pick testteam?
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, test_dude
	nop
	# otherwise, do it again idiot
	j phase_one_begin
	nop
meta_dude:
	li $a0, select_meta
	jal libplp_uart_write_string
	nop
	# meta team identifier for combat
	li $s6, 0x00000001
	jal combat_coinflip
	nop
	j team_building
	nop
front_dude:
	li $a0, select_front
	jal libplp_uart_write_string
	nop
	# meta team identifier for combat
	li $s6, 0x00000002
	jal combat_coinflip
	nop
	j team_building
	nop
haz_dude:
	li $a0, select_haz
	jal libplp_uart_write_string
	nop
	# meta team identifier for combat
	li $s6, 0x00000003
	jal combat_coinflip
	nop
	j team_building
	nop
ex_dude:
	li $a0, select_ex
	jal libplp_uart_write_string
	nop
	# meta team identifier for combat
	li $s6, 0x00000004
	jal combat_coinflip
	nop
	j team_building
	nop
test_dude:
	li $a0, select_test
	jal libplp_uart_write_string
	nop
	# meta team identifier for combat
	li $s6, 0x00000005	
	jal combat_coinflip
	nop
	j team_building
	nop
team_building:
	li $a0, team_build
	jal libplp_uart_write_string
	nop
	jal libplp_uart_read
	nop
	# Never show up
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, TeamFail
	nop
	# did you pick frontend?
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, TeamFail
	nop
	# did you pick hazards?
	move $t0, $v0
	li $t1, 0x00000033
	beq $t0, $t1, TeamFail
	nop
	# did you pick ex?
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, research
	nop
	# otherwise, do it again idiot
	j phase_one_begin
	nop
research:
	li $a0, research_intro
	jal libplp_uart_write_string
	nop
	j research_loop
	nop

research_loop:
	# branch if knowledge = 3
	li $t0, knowledge
	lw $t0, 0($t0)
	li $t1, 0x00000003
	beq $t0, $t1, documentation_intro
	# check the keys and such
	jal libplp_uart_read
	move $t0, $v0
	li $t1, 0x00000078
	beq $t0, $t1, xbox
	nop
	li $t1, 0x0000006D
	beq $t0, $t1, magicka
	nop
	li $t1, 0x00000070
	beq $t0, $t1, pingpong
	nop
	li $t1, 0x00000069
	beq $t0, $t1, internet
	nop
	li $t1, 0x00000026
	beq $t0, $t1, ampersand
	nop
	li $t1, 0x0000006C
	beq $t0, $t1, library
	nop
	li $t1, 0x00000063
	beq $t0, $t1, class
	nop
	li $t1, 0x00000066
	beq $t0, $t1, lab
	nop
	j research_loop
	nop
xbox:
	li $a0, key_x
	jal libplp_uart_write_string
	nop
	j researchfail
	nop
magicka:
	li $a0, key_m
	jal libplp_uart_write_string
	nop
	j research_loop
	nop
pingpong:
	li $a0, key_p
	jal libplp_uart_write_string
	nop
	j research_loop
	nop
internet:
	li $a0, key_i
	jal libplp_uart_write_string
	nop
	j research_loop
	nop
ampersand:
	li $a0, key_ampersand
	jal libplp_uart_write_string
	nop
	li $t0, knowledge
	lw $t0, 0($t0)
	addiu $t0, $t0, 0x00000001
	j research_loop
	nop
library:
	li $a0, key_l
	jal libplp_uart_write_string
	nop
	li $t0, knowledge
	lw $t0, 0($t0)
	addiu $t0, $t0, 0x00000001
	j research_loop
	nop
class:
	li $a0, key_c
	jal libplp_uart_write_string
	nop
	li $t0, knowledge
	lw $t0, 0($t0)
	addiu $t0, $t0, 0x00000001
	j research_loop
	nop
lab:
	li $a0, key_f
	jal libplp_uart_write_string
	nop
	li $t0, knowledge
	lw $t0, 0($t0)
	addiu $t0, $t0, 0x00000001
	j research_loop
	nop

documentation_intro:
	li $a0, doc_intro
	jal libplp_uart_write_string
	nop
	jal combat_coinflip
	nop
	j docuchoice
	nop

docuchoice:
	jal libplp_uart_read
	nop
	# WHAT YOU PICK!?!?!?!??!?!?!!?!!?!?!?!!!!?!?!?!?!??!!?!?!?!?!?!?
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, presentation
	nop
	li $t1, 0x00000032
	beq $t0, $t1, doc_fail_one
	nop
	li $t1, 0x00000033
	beq $t0, $t1, doc_fail_two
	nop
	# sanitize input
	j docuchoice
	nop 

presentation:
	

interview:
	